package youcheng.work.view_zhexian;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.github.mikephil.charting.charts.LineChart;

import org.litepal.crud.DataSupport;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import youcheng.work.view_zhexian.utils.BaseActivity;
import youcheng.work.view_zhexian.view.LineChartManager;

public class MainActivity extends BaseActivity {
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.chartview)
    LineChart chart;



    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        tvTitle.setText("模拟波形图");

        List<Bean> list_all = DataSupport.findAll(Bean.class);
        setLineChart(list_all);



    }


    //折线图
    private void setLineChart(List<Bean> salaryList) {
        LineChartManager lineChartManager = new LineChartManager(chart);

        lineChartManager.showLineChartTwoLines(salaryList, false, "直流信号幅值", getResources().getColor(R.color.color_title_bar));
    }

    @OnClick({R.id.imgv_return})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.imgv_return:
                onBackPressed();
                break;
        }
    }


}